/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package intopo.game.impl.ultimatum;

import intopo.game.Strategy;

/**
 *
 * @author <a href="mailto:mariano.pedro@gmail.com">Pedro Mariano</a>
 *
 * @version 1.0 
 */
abstract public class UltimatumStrategy
	implements Strategy<UltimatumStrategy>
{
	/**
	 * Get the cake division this strategy proposes, how much this strategy gives to the partner.
	 * @return the cake division this strategy proposes.
	 */
	abstract public int getDivisionProposal ();
	/**
	 * Returns {@code true} if the proposed division is acceptable.
	 * @param divisionProposal The cake division proposed by the parner, the amount of cake this strategy gets.
	 * @return {@code true} if the proposed division is acceptable.
	 */
	abstract public boolean isDivisionAcceptable (int divisionProposal);
	/**
	 * Get the roles the strategy can play.
	 * @return the roles the strategy can play.
	 */
	abstract public Role getPlayableRoles ();
	/**
	 * Get the cake size this strategy uses.
	 * 
	 * <p> Field {@code Parameters.cakeSize} is used in constructors that obtain the data from some stream.
	 * 
	 * @return the cake size this strategy uses.
	 */
	abstract public int getCakeSize ();
	/**
	 *
	 */
	static class Parameters
	{
		/**
		 * Cake size used in the <b>Ultimatum</b> game.  The cake can be divided in two parts represented by a pair of integers that must sum {@code cakeSize}.  The first player to move proposes how much cake the second player to move can get.
		 *
		 * <p> This parameter is set in the constructor of class {@code UltimatumGame}.  Afterwards it is used in the constructors of strategies.
		 */
		static int cakeSize;
	}
	/**
	 * The roles a strategy can play in the Ultimatum game.  This is an asymetric game, where one player proposes a division and the other decides if it is acceptable.
	 */
	public enum Role {
		/**
		 * This strategy only makes cake division proposals.
		 */
		PROPONENT,
		/**
		 * This strategy only decides if the division is acceptable or not.
		 */
		DECIDES,
		/**
		 * This strategy can play both roles in the <i>Ultimatum</i> game.
		 */
		BOTH;
	}
}

// Local Variables:
// mode: java
// mode: flyspell-prog
// ispell-local-dictionary: "british"
// End:
